Telegram Group & Telegram Channel
Работаем с данными

pandas - это мощный инструмент для анализа данных в Python. С помощью данного фреймворка, работа с «реляционными» или «помеченными» данными простой и интуитивно понятной. Сегодня мы применим его для модификации csv файла.

Чтобы загрузить датафрейм из файла (пример), используем метод pd.read_csv().

Применим фильтр по полю sepal.length > 5. В SQL данная операция выглядела бы таким образом:
SELECT * FROM df WHERE sepal.length > 5.
В pandas же для получения необходимых строк фрейма можем использовать метод loc, передав в нее необходимый фильтр:
df = df.loc[df['sepal.length'] > 5]

Для удаления одной или нескольких колонок можно использовать метод df.drop():
df = df.drop(columns=['petal.width', 'petal.length'])

При сохранении в файл мы можем дополнительно указать pandas не добавлять генерирующийся индекс строкам, если он нам не нужен:
df.to_csv('new_iris.csv', index = False)

#pandas



tg-me.com/python_academy/744
Create:
Last Update:

Работаем с данными

pandas - это мощный инструмент для анализа данных в Python. С помощью данного фреймворка, работа с «реляционными» или «помеченными» данными простой и интуитивно понятной. Сегодня мы применим его для модификации csv файла.

Чтобы загрузить датафрейм из файла (пример), используем метод pd.read_csv().

Применим фильтр по полю sepal.length > 5. В SQL данная операция выглядела бы таким образом:
SELECT * FROM df WHERE sepal.length > 5.
В pandas же для получения необходимых строк фрейма можем использовать метод loc, передав в нее необходимый фильтр:
df = df.loc[df['sepal.length'] > 5]

Для удаления одной или нескольких колонок можно использовать метод df.drop():
df = df.drop(columns=['petal.width', 'petal.length'])

При сохранении в файл мы можем дополнительно указать pandas не добавлять генерирующийся индекс строкам, если он нам не нужен:
df.to_csv('new_iris.csv', index = False)

#pandas

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/744

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Look for Channels Online

You guessed it – the internet is your friend. A good place to start looking for Telegram channels is Reddit. This is one of the biggest sites on the internet, with millions of communities, including those from Telegram.Then, you can search one of the many dedicated websites for Telegram channel searching. One of them is telegram-group.com. This website has many categories and a really simple user interface. Another great site is telegram channels.me. It has even more channels than the previous one, and an even better user experience.These are just some of the many available websites. You can look them up online if you’re not satisfied with these two. All of these sites list only public channels. If you want to join a private channel, you’ll have to ask one of its members to invite you.

How Does Bitcoin Mining Work?

Bitcoin mining is the process of adding new transactions to the Bitcoin blockchain. It’s a tough job. People who choose to mine Bitcoin use a process called proof of work, deploying computers in a race to solve mathematical puzzles that verify transactions.To entice miners to keep racing to solve the puzzles and support the overall system, the Bitcoin code rewards miners with new Bitcoins. “This is how new coins are created” and new transactions are added to the blockchain, says Okoro.

Python Academy from sa


Telegram Python Academy
FROM USA